package com.nxk.modules.content.web;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.nxk.modules.content.entity.ConAbout;
import com.nxk.modules.content.service.ConAboutService;
import com.nxk.modules.core.entity.SysOffice;
import com.nxk.modules.exception.ResultEntity;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/a/content/about")
public class ConAboutController {
    
    @Autowired
    private ConAboutService conAboutService;


    @RequiresPermissions("content:about:edit")
    @PutMapping("/save")
    public ResultEntity save(@Validated ConAbout conAbout) {
        boolean flag = conAboutService.save(conAbout);
        return flag ? ResultEntity.success(conAboutService.getById(conAbout.getId())) : ResultEntity.fail();
    }

    @RequiresPermissions("content:about:view")
    @GetMapping("/get")
    public ResultEntity get(ConAbout conAbout){
        ConAbout byId = conAboutService.getById(conAbout);
        return ResultEntity.success(byId);
    }
}
